<div class="loader"></div>
<div class="row filter-form-container">
{{ Form::open(array('url' => $base, 'id' => 'form-filter')) }}
	{{-- Form Filter Fields --}}
	<div class='filter-form-group row'>
		<div class="form-group col-md-4">
			{{ Form::label('filter_order_id', $text_filter_order_id) }}
			{{ Form::text('filter_order_id', Input::get('filter_id'), array('class' => 'form-control')) }}
		</div>
		<div class="clearfix"></div>
	</div>
	
	{{-- Form Filter Buttons --}}
	<div class="filter-btn-row row">
		{{ HTML::link(URL::to($base), $text_filter, array('class' => 'btn btn-default', 'id'=> 'filter')) }}
		{{ HTML::link(URL::to($base), $text_generate_picklist , array('class' => 'btn btn-default', 'id'=> 'picklist')) }}
		<input type="Button" id="button_postUploadForDeliveryCompleted" class="btn btn-success" value="{{ $button_upload_fd_to_completed }}"></input>
		<span class="file-loader-progress"></span>
	</div>
{{ Form::close() }}
</div>
<p>&nbsp;</p>
{{ Form::open(array('url' => $base, 'id' => 'form_po_list')) }}
<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
@foreach($results AS $key=>$value)
	
	<div class="row list-row">
	
	<div class="panel panel-default">
		<div class="panel-heading  so_status_{{ $value->status }} success" role="tab" id="so-{{ $value->id }}">
			<a class="header-po-link" poid="{{ $value->id }}" data-toggle="collapse" data-parent="#accordion" href="#so-detail-{{ $value->id }}" aria-expanded="false" aria-controls="so-detail-{{ $value->id }}">
			SO ID <strong>{{ strtoupper($value->id) }}</strong>

			<div class="pull-right">
				{{ HTML::link(URL::to($base.'/generateDR?order_id='.$value->id), 'Generate DR', array('class' => 'btn btn-success generate_dr', 'id'=> 'generate_dr')) }}			
				</div>

			</a>

		</div>
	</div>
	<div id="so-detail-{{ $value->id }}" class="panel-collapse collapse" role="tabpanel" aria-labelledby="so-{{ $value->id }}" >
		<div class="panel-body" id="so-detail-body-{{ $value->id }}">
			<table class="table table-bordered">
				<thead>
					<tr>
						<td> {{ Form::checkbox('so-id[]', $value->id, null, [ 'class' => 'form-control pull-left list_so_id', 'id'=>'so_id']) }}</td>
						<th>Item Id</th>
						<th>{{ $list_vendor_name }}</th>
						<th>{{ $list_order_product_name }}</th>
						<th>{{ $list_order_product_model }}</th>
						<th>{{ $list_order_product_option }}</th>
						<th>{{ $list_order_product_quantity }}</th>
						<th>{{ $list_order_product_price }}</th>
					</tr>
				</thead>
				<tbody>
				@foreach( $value->orderProducts as $so_items )
					<tr>
						<td>{{ ($so_items->status == Constant::ORDER_FOR_DELIVERY) ? Form::checkbox('order_product[' . $so_items->ORDER_id . '][]', $so_items->id, null, [ 'class' => 'form-control so_product']) : ''}}</td>
						<td>{{ $so_items->id }}</td>
						<td>@foreach( $so_items->product->vendors as $vendor)
								{{ $vendor->name }}
							@endforeach</td>
						<td>{{ $so_items->name }}</td>
						<td>{{ $so_items->model }}</td>
						<td>{{ $so_items->ORDER_PRODUCT_OPTION_id }}</td>
						<td>{{ $so_items->quantity }}</td>
						<td>{{ number_format($so_items->benstore_price, 2) }}</td>
	
					</tr>
					
				@endforeach
				</tbody>
			</table>
		</div>
	</div>
	</div>
@endforeach
</div>
{{ Form::close() }}

<div class="box-footer">
	<div class="col-xs-14 text-center">
		<div class="dataTables_info">Showing {{ $results->getFrom() }} to {{ $results->getTo() }} of {{ $results->getTotal() }} entries</div>
	</div>
	<div class="col-xs-14 text-center">
		<div class="no-margin">
		{{ $results->links() }}
		</div>
	</div>
</div>

<script src="{{ Asset::bea('javascript/jquery/jquery.delivery-list.js') }}"></script>